package SwingModel;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public class CmsAssignment {

	private final int asgmID;
	private final String asgmTitle;
	private final String asgmDescription;
	private List<File> asgmFile;
	private final double percentWeight;
	private Date createdDate;
	private Date avaiDate;
	private Date dueDate;
	private Date expDate;
	private boolean hasTaken;
	
	
	public CmsAssignment(int asgmID, String asgmTitle, String asgmDescription,
			List<File> asgmFile,
			double percentWeight,Date createdDate, Date avaiDate, Date dueDate, Date expDate) {
		this.asgmID = asgmID;
		this.asgmTitle = asgmTitle;
		this.asgmDescription = asgmDescription;
		this.asgmFile = asgmFile;
		this.createdDate = createdDate;
		this.percentWeight = percentWeight;
		this.avaiDate = avaiDate;
		this.dueDate = dueDate;
		this.expDate = expDate;
		setHasTaken(false);
	}
	
	
	@Override
	public String toString(){
		SimpleDateFormat sdf = new SimpleDateFormat("YYYY:MM:dd HH:mm:ss");
		StringBuilder returnString = new StringBuilder();
		returnString.append("Assignment: \n"
				+ "asgmID: " + asgmID + "\n"
				+ "asgmTitle: " + asgmTitle + "\n"
				+ "asgmDescription: " + asgmDescription + "\n"
				+ "Weight: " + percentWeight + "%" + "\n"
				+ "createdDate: " + sdf.format(createdDate) + "\n"
				+ "avaiDate: " + sdf.format(avaiDate) + "\n"
				+ "dueDate: " + sdf.format(dueDate) + "\n"				
				+ "expDate: " + sdf.format(expDate) + "\n");
		
		int i=1;
		for(File f : asgmFile){
			returnString.append("File" + i + ": " + f.getPath() + "\n");
		}
		
		return returnString.toString();
	}
	/* DONT DELETE THIS
	public boolean equals(CmsAssignment compAsgm){
		if( ! this.asgmTitle.equals(compAsgm.getAsgmTitle())) return false;
		if( ! this.asgmDescription.equals(compAsgm.getAsgmDescription())) return false;
		if( this.avaiDate.getTime() != compAsgm.getAvaiDate().getTime()) return false;
		if( this.dueDate.getTime() != compAsgm.getDueDate().getTime()) return false;
		if( this.expDate.getTime() != compAsgm.getExpDate().getTime()) return false;
		if( this.percentWeight != compAsgm.getPercentWeight()) return false;
		return true;
	}*/
	
		
	//Getters and Setters
	
	public int getAsgmID() {
		return asgmID;
	}



	public String getAsgmTitle() {
		return asgmTitle;
	}



	public String getAsgmDescription() {
		return asgmDescription;
	}



	public double getPercentWeight() {
		return percentWeight;
	}


	public Date getAvaiDate() {
		return avaiDate;
	}



	public void setAvaiDate(Date avaiDate) {
		this.avaiDate = avaiDate;
	}



	public Date getDueDate() {
		return dueDate;
	}



	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}



	public Date getExpDate() {
		return expDate;
	}



	public void setExpDate(Date expDate) {
		this.expDate = expDate;
	}


	public Date getCreatedDate() {
		return createdDate;
	}


	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	
	public List<File> getListOfFile(){
		return this.asgmFile;
	}
	
	public void setListOfFile(List<File> listOfFile){
		asgmFile = listOfFile;
	}


	public boolean isHasTaken() {
		return hasTaken;
	}


	public void setHasTaken(boolean hasTaken) {
		this.hasTaken = hasTaken;
	}

}
